package com.trend.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.trend.config.IpConfiguration;
import com.trend.pojo.IndexData;
import com.trend.service.IndexDataService;

@RestController
public class IndexDataController {

	@Autowired
	IndexDataService indexDataService;
	@Autowired
	IpConfiguration ipConfiguration;

	@GetMapping("/data/{code}")
	public List<IndexData> get(@PathVariable("code") String code) throws Exception {
		System.out.println("current instance's :" + ipConfiguration.getPort());
		return indexDataService.get(code);
	}

}
